﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminIndexMaster.master" AutoEventWireup="true" CodeFile="CM_Ad_Update.aspx.cs" Inherits="Admin_CM_Ad_Update" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script src="../Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../Js/celendar.js" type="text/javascript"></script>
    <script type="text/javascript">


        function callBack(fileName) {
            document.getElementById('ctl00_ContentPlaceHolder1_<%=Request.QueryString["act"]=="add"?"ImgUrlAdd":"ImgUrlUpdate" %>').value = fileName;

        }

        function CheckData() {
            if ($("#ctl00_ContentPlaceHolder1_txtAdName").val() == "") {
                alert("广告名称不能为空");
                return false;
            }
            var flag = false;
            $("#ctl00_ContentPlaceHolder1_rblAddArea tbody tr").find("td input").each(function (i) {
                if ($(this).attr("checked")) {
                    switch ($(this).val()) {
                        case "3":
                            if ($("#ctl00_ContentPlaceHolder1_ddlAddArea").val() == "") {
                                alert("请选择地区！");
                                flag = true;
                                break;
                            }
                        case "2":
                            if ($("#ctl00_ContentPlaceHolder1_ddlAddCity").val() == "") {
                                alert("请选择城市！");
                                flag = true;
                                break;
                            }
                        case "1":
                            if ($("#ctl00_ContentPlaceHolder1_ddlAddProvince").val() == "") {
                                alert("请选择省份！");
                                flag = true;
                            }
                            break;

                    }
                }
            });
            if (flag) {
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_txtBeginTime").val() == "") {
                alert("开始时间不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_TxtEndTime").val() == "") {
                alert("结束时间不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_txtLinkUrl").val() == "") {
                alert("链接地址不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_txtLinkTip").val() == "") {
                alert("链接提示不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_ImgUrlAdd").val() == "") {
                alert("图片还没有上传！");
                return false;
            }

            return true;
        }

        function UpdateCheckData() {

            if ($("#ctl00_ContentPlaceHolder1_UtxtAdName").val() == "") {
                alert("广告名称不能为空");
                return false;
            }
            var flag = false;
            $("#ctl00_ContentPlaceHolder1_rblUpdateArea tbody tr").find("td input").each(function (i) {
                if ($(this).attr("checked")) {
                    switch ($(this).val()) {
                        case "3":
                            if ($("#ctl00_ContentPlaceHolder1_ddlUpdateArea").val() == "") {
                                alert("请选择地区！");
                                flag = true;
                                break;
                            }
                        case "2":
                            if ($("#ctl00_ContentPlaceHolder1_ddlUpdateCity").val() == "") {
                                alert("请选择城市！");
                                flag = true;
                                break;
                            }
                        case "1":
                            if ($("#ctl00_ContentPlaceHolder1_ddlUpdateProvince").val() == "") {
                                alert("请选择省份！");
                                flag = true;
                            }
                            break;

                    }
                }
            });
            if (flag) {
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_UtxtBeginDate").val() == "") {
                alert("开始时间不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_UtxtEndDate").val() == "") {
                alert("结束时间不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_UtxtLinkUrl").val() == "") {
                alert("链接地址不能为空");
                return false;
            }
            if ($("#ctl00_ContentPlaceHolder1_UtxtLinkTip").val() == "") {
                alert("链接提示不能为空");
                return false;
            }

            if ($("#ctl00_ContentPlaceHolder1_ImgUrlUpdate").val() == "") {
                alert("图片还没有上传！");
                return false;
            }
            return true;
        }
    </script>
    <table width="100%" runat="server" id="AddTabel" class="nick" cellpadding="1" cellspacing="1"
        border="0">
        <tr>
            <td class="ltd">
                <strong>广告名称：</strong>
            </td>
            <td colspan="3" class="rtd">
                <asp:TextBox ID="txtAdName" Width="250px" MaxLength="100" runat="server"></asp:TextBox><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="txtAdName"
                    runat="server" Display="Dynamic" ErrorMessage="广告名称不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="ltd">
                <strong>广告版位：</strong>
            </td>
            <td class="rtd">
                <asp:DropDownList ID="ddlLocation" runat="server">
                    <asp:ListItem Value="火车头版位1">火车头版位1（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位2">火车头版位2（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位3">火车头版位3（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位4">火车头版位4（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位5">火车头版位5（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位6">火车头版位6（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位7">火车头版位7（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位8">火车头版位8（98*59）</asp:ListItem>
                    <asp:ListItem Value="首页横幅版位">首页横幅版位（982*121）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品1">首页推荐产品1（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品2">首页推荐产品2（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品3">首页推荐产品3（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品4">首页推荐产品4（220*310）</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="ltd">
                &nbsp;
            </td>
            <td class="rtd">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="ltd">
                <strong>广告地区：</strong>
            </td>
            <td class="rtd">
                <asp:RadioButtonList ID="rblAddArea" RepeatDirection="Horizontal" AutoPostBack="true"
                    OnSelectedIndexChanged="rblAddArea_SelectedIndexChanged" runat="server">
                    <asp:ListItem Value="1" Selected="True">省份广告</asp:ListItem>
                    <asp:ListItem Value="2">城市广告</asp:ListItem>
                    <asp:ListItem Value="3">地区广告</asp:ListItem>
                </asp:RadioButtonList>
            </td>
            <td class="ltd">
                &nbsp;
            </td>
            <td class="rtd" style="width: 200px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="ltd">
                &nbsp;
            </td>
            <td style="width: 200px;" class="rtd">
                <table style="width: 70%">
                    <tr>
                        <td style="width: 30%; text-align: left;">
                            <asp:DropDownList Width="120px" AutoPostBack="true" ID="ddlAddProvince" OnSelectedIndexChanged="ddlAddProvince_OnSelectedIndexChanged"
                                runat="server">
                            </asp:DropDownList>
                        </td>
                        <td style="width: 30%; text-align: left;">
                            <asp:DropDownList Width="120px" AutoPostBack="true" ID="ddlAddCity" OnSelectedIndexChanged="ddlAddCity_OnSelectedIndexChanged"
                                runat="server">
                                <asp:ListItem Value="">请选择城市...</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td style="text-align: left;">
                            <asp:DropDownList ID="ddlAddArea" Width="120px" runat="server" AutoPostBack="True">
                                <asp:ListItem Value="">请选择地区...</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </td>
            <td class="ltd">
                &nbsp;
            </td>
            <td style="width: 200px;" class="rtd">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="ltd">
                <strong>开始时间：</strong>
            </td>
            <td style="width: 200px;" class="rtd">
                <input id="txtBeginTime" maxlength="55" readonly="readonly" class="text" style="width: 100px;"
                    size="58" runat="server" /><font color="red">*</font><asp:RequiredFieldValidator
                        ID="RequiredFieldValidator1" Display="Dynamic" ControlToValidate="txtBeginTime"
                        runat="server" ErrorMessage="开始时间不能为空！"></asp:RequiredFieldValidator>
            </td>
            <td class="ltd">
                <strong>结束时间：</strong>
            </td>
            <td style="width: 200px;" class="rtd">
                <asp:TextBox ID="TxtEndTime" MaxLength="20" Width="100px" ReadOnly="true" runat="server" /><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TxtEndTime"
                    runat="server" Display="Dynamic" ErrorMessage="结束时间不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="ltd">
                <strong>链接地址：</strong>
            </td>
            <td style="width: 200px;" class="rtd">
                <asp:TextBox ID="txtLinkUrl" MaxLength="200" Width="250px" runat="server"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                    ID="RequiredFieldValidator3" ControlToValidate="txtLinkUrl" runat="server" Display="Dynamic"
                    ErrorMessage="链接地址不能为空！"></asp:RequiredFieldValidator>
            </td>
            <td class="ltd">
                <strong>链接提示：</strong>
            </td>
            <td style="width: 200px;" class="rtd">
                <asp:TextBox ID="txtLinkTip" MaxLength="50" Width="250px" runat="server"></asp:TextBox><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtLinkTip"
                    runat="server" Display="Dynamic" ErrorMessage="链接提示不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="ltd">
                <strong>图片上传：</strong>
            </td>
            <td class="rtd" colspan="3">
                <iframe id="file" name="file" src="Admin_attachment.aspx" frameborder="0" width="500px"
                    scrolling="no" height="130px"></iframe>
                <!--ImgUrl保存图片地址的值-->
                <input id="ImgUrlAdd" type="text" style="display: none;" name="ImgUrl" maxlength="255"
                    runat="server" />
            </td>
        </tr>
        <tr>
            <td style="width: 200px;" class="ltd">
                <strong>广告简介：</strong>
            </td>
            <td colspan="3" class="rtd">
                <asp:TextBox ID="txtIntroduce" TextMode="MultiLine" Rows="3" Columns="58" MaxLength="200"
                    runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 200px;" class="ltd">
                <strong>是否启用：</strong>
            </td>
            <td class="rtd" colspan="3">
                <asp:CheckBox ID="cbEnable" runat="server" Text="启用 " />
            </td>
        </tr>
        <tr>
            <td class="btm" colspan="4">
                <asp:Button ID="ButAdd" runat="server" OnClientClick="return CheckData()" OnClick="ButAdd_Click"
                    Text="添加" />&nbsp; &nbsp;
                <input type="button" value="返回" onclick="window.location.href='CM_Ad_Manage.aspx?MenuID=7&MenuName=服务&FileName=广告管理'" />
            </td>
        </tr>
    </table>
    <table width="100%" runat="server" id="UpdateTable" class="nick" cellpadding="1"
        cellspacing="1" border="0">
        <tr>
            <td class="ltd" style="width: 15%">
                <strong>广告名称：</strong>
            </td>
            <td class="rtd" style="width: 15%">
                <asp:TextBox ID="UtxtAdName" Width="250px" MaxLength="100" runat="server"></asp:TextBox><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate="UtxtAdName"
                    runat="server" Display="Dynamic" ErrorMessage="广告名称不能为空！"></asp:RequiredFieldValidator>
            </td>
            <td class="ltd" style="width: 15%">
                &nbsp;
            </td>
            <td class="rtd" style="width: 35%">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>广告版位：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <asp:DropDownList ID="UddlLocation" runat="server">
                    <asp:ListItem Value="火车头版位1">火车头版位1（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位2">火车头版位2（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位3">火车头版位3（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位4">火车头版位4（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位5">火车头版位5（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位6">火车头版位6（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位7">火车头版位7（98*59）</asp:ListItem>
                    <asp:ListItem Value="火车头版位8">火车头版位8（98*59）</asp:ListItem>
                    <asp:ListItem Value="首页横幅版位">首页横幅版位（982*121）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品1">首页推荐产品1（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品2">首页推荐产品2（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品3">首页推荐产品3（220*310）</asp:ListItem>
                    <asp:ListItem Value="首页推荐产品4">首页推荐产品4（220*310）</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="ltd" style="width: 15%">
            </td>
            <td class="rtd" style="width: 35%">
            </td>
        </tr>
        <tr>
            <td style="width: 90%" class="ltd">
                <strong>广告地区：</strong>
            </td>
            <td class="rtd" rowspan="1" style="width: 15%">
                <asp:RadioButtonList ID="rblUpdateArea" AutoPostBack="true" RepeatDirection="Horizontal"
                    OnSelectedIndexChanged="rblUpdateArea_SelectedIndexChanged" runat="server">
                    <asp:ListItem Value="1" Selected="True">省份广告</asp:ListItem>
                    <asp:ListItem Value="2">城市广告</asp:ListItem>
                    <asp:ListItem Value="3">地区广告</asp:ListItem>
                </asp:RadioButtonList>
            </td>
            <td class="ltd" style="width: 15%">
                &nbsp;
            </td>
            <td class="rtd" style="width: 35%">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>&nbsp;</strong>
            </td>
            <td style="width: 35%" class="rtd">
                <table style="width: 70%">
                    <tr>
                        <td style="width: 30%; text-align: left;">
                            <asp:DropDownList ID="ddlUpdateProvince" AutoPostBack="true" OnSelectedIndexChanged="ddlUpdateProvince_OnSelectedIndexChanged"
                                runat="server">
                            </asp:DropDownList>
                        </td>
                        <td style="width: 30%; text-align: left;">
                            <asp:DropDownList ID="ddlUpdateCity" AutoPostBack="true" OnSelectedIndexChanged="ddlUpdateCity_OnSelectedIndexChanged"
                                runat="server">
                                <asp:ListItem Value="">请选择城市...</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td style="text-align: left;">
                            <asp:DropDownList ID="ddlUpdateArea" runat="server">
                                <asp:ListItem Value="">请选择地区...</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 15%" class="ltd">
            </td>
            <td class="rtd" style="width: 15%">
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>开始时间：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <asp:TextBox ID="UtxtBeginDate" MaxLength="55" Width="100px" runat="server"></asp:TextBox><font
                    color="red">*</font><asp:RequiredFieldValidator ID="RequiredFieldValidator8" Display="Dynamic"
                        ControlToValidate="UtxtBeginDate" runat="server" ErrorMessage="开始时间不能为空！"></asp:RequiredFieldValidator>
            </td>
            <td style="width: 15%" class="ltd">
                <strong>结束时间：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <asp:TextBox ID="UtxtEndDate" MaxLength="20" Width="100px" runat="server" /><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" ControlToValidate="UtxtEndDate"
                    runat="server" Display="Dynamic" ErrorMessage="结束时间不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>链接地址：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <asp:TextBox ID="UtxtLinkUrl" MaxLength="200" Width="250px" runat="server"></asp:TextBox><font
                    color="red"></font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator10" ControlToValidate="UtxtLinkUrl"
                    runat="server" Display="Dynamic" ErrorMessage="链接地址不能为空！"></asp:RequiredFieldValidator>
            </td>
            <td style="width: 15%" class="ltd">
                <strong>链接提示：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <asp:TextBox ID="UtxtLinkTip" MaxLength="50" Width="250px" runat="server"></asp:TextBox><font
                    color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator11" ControlToValidate="UtxtLinkTip"
                    runat="server" Display="Dynamic" ErrorMessage="链接提示不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>图片上传：</strong>
            </td>
            <td class="rtd" style="width: 35%">
                <iframe id="Iframe1" name="file" src="Admin_attachment.aspx" frameborder="0" width="500px"
                    scrolling="no" height="120px"></iframe>
                <!--ImgUrl保存图片地址的值-->
                <input id="ImgUrlUpdate" type="text" style="display: none;" name="ImgUrl" maxlength="255"
                    runat="server" />
            </td>
            <td style="width: 15%" class="ltd">
                <strong>原来图片：</strong>
            </td>
            <td style="width: 35%" class="rtd">
                <asp:Image ID="PrevImg" Width="110px" Height="110px" runat="server" />
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>广告简介：</strong>
            </td>
            <td style="width: 85%" colspan="3" class="rtd">
                <asp:TextBox ID="UtxtIntro" TextMode="MultiLine" Rows="3" Columns="58" MaxLength="200"
                    runat="server"></asp:TextBox><font color="red">*</font>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator12" ControlToValidate="UtxtIntro"
                    runat="server" Display="Dynamic" ErrorMessage="广告简介不能为空！"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 15%" class="ltd">
                <strong>是否启用：</strong>
            </td>
            <td class="rtd" style="width: 85%" colspan="3">
                <asp:CheckBox ID="UcbEnable" runat="server" Text="启用 " Checked="true" />
            </td>
        </tr>
        <tr>
            <td class="btm" colspan="4">
                <asp:Button ID="BtnUpdate" runat="server" OnClientClick="return UpdateCheckData()"
                    OnClick="BtnUpdate_Click" Text="更改" />&nbsp;&nbsp; &nbsp;
                <input type="button" value="返回" onclick="window.location.href='CM_Ad_Manage.aspx?MenuID=7&MenuName=服务&FileName=广告管理'" />
            </td>
        </tr>
    </table>
</asp:Content>
